-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev-ai #264
Conversation
… `TextDeepSeekModel`
Reviewer's Guide by SourceryThis pull request introduces AI text generation capabilities using OpenAI and DeepSeek models. It includes new services for AI text generation and encryption, along with corresponding models and error handling. The changes also involve integrating these services into the application, allowing users to leverage AI for text-related tasks. Sequence diagram for AI text request flowsequenceDiagram
participant Browser
participant BrowserChannel as BrowserAITextChannel
participant MainService as MainAITextService
participant Model as AI Model
participant API as AI Provider API
Browser->>BrowserChannel: sendRequest(options)
BrowserChannel->>MainService: IPC call: sendRequest
MainService->>Model: sendRequest(options)
Model->>API: API request
API-->>Model: Response
Model-->>MainService: Formatted response
MainService-->>BrowserChannel: IPC response
BrowserChannel-->>Browser: AI.Text.Response
Class diagram for AI text service and modelsclassDiagram
class IAITextService {
<<interface>>
+init()
+switchModel(options)
+updateAPIKey(newKey, modelType, persisted)
+sendRequest(options)
+sendRequestStream(options, onChunkReceived)
}
class LLMModel {
<<abstract>>
+modality: AI.Modality
+name: AI.ModelName
+apiKey: string
+setAPIKey(newKey)
}
class TextSharedOpenAIModel {
<<abstract>>
+modality: AI.Modality.Text
+name: AI.ModelName
+apiKey: string
+setAPIKey(newKey)
+sendRequest(options)
+sendRequestStream(options, onChunkReceived)
}
class TextGPTModel {
+name: AI.ModelName.ChatGPT
}
class TextDeepSeekModel {
+name: AI.ModelName.DeepSeek
}
LLMModel <|-- TextSharedOpenAIModel
TextSharedOpenAIModel <|-- TextGPTModel
TextSharedOpenAIModel <|-- TextDeepSeekModel
note for TextSharedOpenAIModel "Base class for OpenAI-compatible models"
note for LLMModel "Base class for all LLM models"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Bistard - I've reviewed your changes - here's some feedback:
Overall Comments:
- The MainAITextService returns GPTModel for both TextModelType.GPT and TextModelType.DeepSeek. If DeepSeek should have different behavior, it needs its own model implementation.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@sourcery-ai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Bistard - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider standardizing error handling approach across the codebase - currently mixing Result types and direct throws/panics. Pick one consistent pattern for better reliability.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@sourcery-ai guide |
Summary by Sourcery
New Features:
IAITextService
: Integrate OpenAI and DeepSeek AI text models for text generation.IEncryptionService
: support encryption/decryption functionalityAIModelRegistrant
LLMModel
TextSharedOpenAIModel
TextGPTModel
TextDeepSeekModel
AIError
for standardized error handling relates to LLM